package com.shujia.mr.hw.home3;

import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;

import java.io.IOException;

public class Home3Part2Mapper extends Mapper<LongWritable, Text,Text,Student> {

    @Override
    protected void map(LongWritable key, Text value, Mapper<LongWritable, Text, Text, Student>.Context context) throws IOException, InterruptedException {
        //
        String oneLine = value.toString();
        String[] columns = oneLine.split(",");
        // 以班级信息为Key 进行写出，在Reduce端做数据的聚合
        context.write(new Text(columns[4]),new Student(columns[0],columns[1],columns[2],columns[3],columns[4],columns[5]));
    }
}
